<template>
	<view>
		<u-navbar leftIconColor="#000000" :titleStyle="{ color: '#000000' }" :bgColor="bgColor" title="帮助与反馈"
			:placeholder="true" :autoBack="true"></u-navbar>
		<view class="note">

		</view>
		<view class="content" style="position: relative;z-index: 1;">
			<view class="flex"
				style="flex-direction: column;align-items: flex-start;width: 92%;margin: 0 auto;padding: 35px 0;">
				<text style="font-size: 18px;font-weight: 400;color: #19153D;">Hi,有什么可以帮您的！</text>
				<text style="font-size: 12px;font-weight: 400;color: #748CBB;padding-top: 12px;">在线客服为您服务</text>
			</view>
			<view style="width: 92%;margin: 0 auto;">

				<scroll-view @scrolltolower="redis" scroll-y="true"
					style="height: 268px;background-color: #fff;width: 92%;margin: 0 auto;padding: 15px;border-radius: 10px;">
					<view @click="ques_detail(it)" v-for="(it, i) in arr" :key="i"
						style="background-color: #F7F7F7; border-radius: 10px; padding: 15px; margin-bottom: 15px">
						<view style="font-size: 16px; color: #1d1f20; font-weight: 400">{{ it.title }}</view>
						<view class="tits">
							<view v-html="it.introduction"></view>
						</view>
					</view>
					<u-loadmore v-if="show" :status="status" :icon-type="iconType" :load-text="loadText" />
				</scroll-view>


			</view>
			<!-- <view style="position: fixed; bottom: 0; background-color: #fff; padding: 8px 0px; width: 100%">
				<view class="flex" @click="our_feedback"
					style="background-color: #ff3331; margin: 0px 15px; padding: 6px 0; border-radius: 5px; justify-content: center">
					<image style="width: 16px" src="/static/img/60.png" mode="widthFix"></image>
					<view style="font-size: 14px; color: #fff; margin-left: 10px">我要反馈</view>
				</view>
			</view> -->
			<view class="" style="width: 92%;margin: 0 auto;">
				<view class="flex">
					<view @click="unin(1)" :class="[art == 1 ? 'un' : 'an']"
						style="font-size: 16px; color: #1d1f20; margin: 15px 0">常见问题</view>
					<view @click="unin(2)" :class="[art == 2 ? 'un' : 'an']"
						style="font-size: 16px; color: #666666; margin: 15px;">平台客服</view>
				</view>

				<view class="" style="padding: 25px 0;background-color: #fff; border-radius: 10px;">
					<text style="font-size: 15px;font-weight: 600;color: #333333;padding-left: 15px;">常用工具</text>
					<view class="flex"
						style=" padding: 15px; justify-content: space-between">

						<view @click="our_feedback" style="text-align: center">
							<image style="width: 30px" src="/static/font/44.png" mode="widthFix"></image>
							<view style="font-size: 14px; margin-top: 10px">我要反馈</view>
						</view>
						<view @click="feedback" style="text-align: center">
							<image style="width: 30px" src="/static/font/47.png" mode="widthFix"></image>
							<view style="font-size: 14px; margin-top: 10px">反馈记录</view>
						</view>
						<view @click="project" style="text-align: center">
							<image style="width: 30px" src="/static/font/45.png" mode="widthFix"></image>
							<view style="font-size: 14px; margin-top: 10px">项目教程</view>
						</view>
						<view @click="call" style="text-align: center">
							<image style="width: 30px" src="/static/font/46.png" mode="widthFix"></image>
							<view style="font-size: 14px; margin-top: 10px">联系上级</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page: 1,
				data: [],
				arr: [],
				status: 'loadmore',
				iconType: 'flower',
				loadText: {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '实在没有了',
				},
				show: false,
				com_info: '',
				art: 1,
				bgColor: 'rgba(255,255,255,0)',
			};
		},
		onPageScroll(e) {
			if (e.scrollTop > 50) {
				this.bgColor = 'rgba(255,255,255,1)'
			} else {
				this.bgColor = 'rgba(255,255,255,0)'
			}
		},
		onLoad() {
			this.common();
		},
		onShow() {
			this.page = 1;
			this.arr = [];
			this.noviceList();
		},
		onReachBottom() {
			this.show = true;
			if (this.data.length == '') return;
			this.status = 'loading';
			this.page++;
			this.noviceList();
			setTimeout(() => {
				if (this.data == '') this.status = 'nomore';
				else this.status = 'loading';
			}, 1000);
		},
		methods: {
			unin(e) {
				this.art = e
				if (e == 2) {
					this.kegu()
				}
			},
			redis() {
				this.show = true;
				if (this.data.length == '') return;
				this.status = 'loading';
				this.page++;
				this.noviceList();
				setTimeout(() => {
					if (this.data == '') this.status = 'nomore';
					else this.status = 'loading';
				}, 1000);
			},
			kegu() {
				// #ifdef H5
				window.location.href = this.com_info.wxCustomerService;
				// #endif
				// #ifdef APP
				plus.runtime.openURL(this.com_info.wxCustomerService);
				// #endif
			},
			async common() {
				let res = await this.$http.index.index();
				if (res.code == 1) {
					this.com_info = res.data;
				}
			},
			async noviceList() {
				let res = await this.$http.car.noviceList({
					type: 4,
					page: this.page,
					pageNum: 10,
				});
				if (res.code == 1) {
					this.data = res.data;
					this.arr = [...this.arr, ...this.data];
				}
			},
			project() {
				uni.navigateTo({
					url: '/pages/home/novice?cur=1',
				});
			},
			//联系上级
			call() {
				uni.navigateTo({
					url: '/pages/me/call',
				});
			},
			ques_detail(it) {
				uni.navigateTo({
					url: '/pages/home/detail?id=' + it.id,
				});
			},

			//列表
			feedback() {
				uni.navigateTo({
					url: '/pages/me/feedback',
				});
			},
			//我要反馈
			our_feedback() {
				uni.navigateTo({
					url: '/pages/me/our_feedback',
				});
			},
		},
	};
</script>

<style scoped lang="less">
	.flex {
		display: flex;
		align-items: center;
	}

	.tits {
		font-size: 14px;
		font-weight: 400;
		overflow: hidden;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		text-overflow: ellipsis;
		margin-top: 15px;
		color: #777979;
	}

	.note {
		background-image: url('@/static/font/42.png');
		position: fixed;
		width: 100%;
		height: 304px;
		top: 0;
		background-size: 100% 100%;
	}

	.un {
		// background-image: url('@/static/font/43.png');
		background: #fff;
		box-shadow: 0px 2 5px 0px rgba(0, 0, 0, 0.05);
		border-radius: 8px 8px 8px 8px;
		padding: 8px 15px;
	}

	.an {
		background: #FCFCFC;
		box-shadow: 0px 2 5px 0px rgba(0, 0, 0, 0.05);
		border-radius: 8px 8px 8px 8px;
		padding: 8px 15px;
	}
</style>
<style>
	page {
		background-color: #F9F9F9;
	}
</style>